/**
 * Hack for ListField: make the sub-elements wirable by adding a reference to the container and setting the name of
 * the subfield (to use in terminal.dflyName)
 */
inputEx.ListField.prototype.renderSubField = function(value) {
    
    // Div that wraps the deleteButton + the subField
    var newDiv = inputEx.cn('div');
    
    // Delete button
    var delButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-delButton'});
    YAHOO.util.Event.addListener( delButton, 'click', this.onDelete, this, true);
    newDiv.appendChild( delButton );
    
    // Instanciate the new subField
    var class0 = inputEx.getFieldClass(this.options.elementType.type);
    var options = {};
    if( this.options.elementType.typeOptions) {
       for(var key in this.options.elementType.typeOptions) {
          if(this.options.elementType.typeOptions.hasOwnProperty(key) ) {
             options[key] = this.options.elementType.typeOptions[key];
          }
       }
    }
    if(value) { options.value = value; }
    
    options.container = this.options.container;
    options.name = this.options.name+"["+(this.getValue().length)+"]";
    
    if(this.options.wirable) {
       options.wirable = true;
    }
    
    var el = new class0(options);
    var subFieldEl = el.getEl();
    YAHOO.util.Dom.setStyle(subFieldEl, 'margin-left', '4px');
    YAHOO.util.Dom.setStyle(subFieldEl, 'float', 'left');
    newDiv.appendChild( subFieldEl );
    
    // Subscribe the onChange event to resend it 
    el.updatedEvt.subscribe(this.onChange, this, true);

    // Line breaker
    newDiv.appendChild( inputEx.cn('div', null, {clear: "both"}) );

    this.divEl.appendChild(newDiv);
    
    return el;
 };




